<?php

use yii\grid\GridView;
use common\helpers\Html;
use common\helpers\ImageHelper;

$this->title                   = '入金管理';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>

            </div>
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel'  => $searchModel,
                    //重新定义分页样式
                    'tableOptions' => ['class' => 'table table-hover'],
                    'columns'      => [
                        [
                            'class' => 'yii\grid\SerialColumn',
                        ],
                        [
                            'attribute' => 'openid',
                            'value'     => function ($model) {
                                return $model->member->username;
                            },
                            'filter'    => FALSE,
                            'format'    => 'raw',
                        ],
                        [
                            'label'  => '真实姓名',
                            'value'  => function ($model) {
                                return $model->member->realname;
                            },
                            'filter' => FALSE,
                            'format' => 'raw',
                        ],
                        [
                            'label'  => '开户行',
                            'value'  => function ($model) {
                                return $model->member->bank_name;
                            },
                            'filter' => FALSE,
                            'format' => 'raw',
                        ],
                        [
                            'label'  => '银行卡号',
                            'value'  => function ($model) {
                                return $model->member->bank_card;
                            },
                            'filter' => FALSE,
                            'format' => 'raw',
                        ],
                        'out_trade_no',
                        [
                            'attribute' => 'pay_fee',
                            'filter' => FALSE,
                            'format' => 'raw',
                        ],
                        [
                            'label'  => '方向',
                            'filter' => FALSE, //不显示搜索框
                            'value'  => function ($model) {
                                if ($model->order_group == 'in') {
                                    return '入金';
                                }else {
                                    return '出金';
                                }
                            },
                            'format' => 'raw',
                        ],
                        [
                            'label'  => '申请时间',
                            'filter' => FALSE, //不显示搜索框
                            'value'  => function ($model) {
                                return date('Y-m-d H:i:s', $model->member_id);
                            },
                            'format' => 'raw',
                        ],
                        [
                            'header'   => "操作",
                            'class'    => 'yii\grid\ActionColumn',
                            'template' => '{statusy} {statysn} ',
                            'buttons'  => [
                                'statusy' => function ($url, $model, $key) {
                                    return Html::linkButton([
                                        'price-in',
                                        'id'        => $model->id,
                                        'status'    => '1',
                                        'member_id' => $model->member_id,
                                    ], '通过', [
                                        'class' => 'btn btn-success btn-sm',
                                    ]);
                                },
                                'statysn' => function ($url, $model, $key) {
                                    return Html::linkButton([
                                        'price-in',
                                        'id'        => $model->id,
                                        'status'    => '-1',
                                        'member_id' => $model->member_id,
                                    ], '驳回111', [
                                        'class' => 'btn btn-danger btn-sm',
                                    ]);
                                },
                            ],
                        ],
                    ],
                ]); ?>
            </div>
        </div>
    </div>